#ifndef VIRTUALCROSS_H
#define VIRTUALCROSS_H
#include <QWidget>
#include <QTcpSocket>
#include <QTimer>
#include <QColor>
#include <QList>
#include <QJsonObject>

namespace Ui {
class VirtualCross;
}

struct TransLamp {
    QColor color;
    int count;
};

class VirtualCross : public QWidget
{
    Q_OBJECT

public:
    explicit VirtualCross(const int &id, QWidget *parent = nullptr);
    ~VirtualCross();


private slots:
    void slot_sendState();
    void slot_stateChanged(QAbstractSocket::SocketState state);
    void slot_readyRead();
private:
    void init();
    void sendState();
    void setAllRed();
    Ui::VirtualCross *ui;
    QTcpSocket socket;
    const int id;
    QList<TransLamp> list_transLamp;
    QTimer *timer;
};

#endif // VIRTUALCROSS_H
